<?php

namespace Biz\service\Userpenalty;

class PenaltyStrategy
{
    const TYPE_STOP_COMMENT = 1;
    const TYPE_FROZEN = 2;
    const TYPE_FORBIDDEN = 3;
    const TYPE_OPERATE_LOGO = 4;


    public static function addPunish($type , $data)
    {
        switch ($type){
            case self::TYPE_FORBIDDEN:
                $obj = new Forbidden();
                break;
            case self::TYPE_FROZEN:
                $obj = new Frozen();
                break;
            case self::TYPE_OPERATE_LOGO:
                $obj = new OperateLogo();
                break;
            case self::TYPE_STOP_COMMENT:
                $obj = new StopComment();
                break;
        }
        if(empty($obj)) return false;

        $result =   $obj->handle($data);
        return $result;
    }

    public static function cancle($type , $data)
    {
        switch ($type){
            case self::TYPE_FORBIDDEN:
                $obj = new Forbidden();
                break;
            case self::TYPE_FROZEN:
                $obj = new Frozen();
                break;
            case self::TYPE_OPERATE_LOGO:
                $obj = new OperateLogo();
                break;
            case self::TYPE_STOP_COMMENT:
                $obj = new StopComment();
                break;
        }
        if(empty($obj)) return false;
        if($type == self::TYPE_OPERATE_LOGO){
            $result = $obj->handle($data);
        }else{
            $result = $obj->cancle($data);
        }
        return $result;
    }



}